using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Entities;

namespace BUS
{
  public   class tbTrangthaidonhangBUS
    {
        public static void insert(tbTrangthaidonhang  ttdhang)
        {
            tbTrangthaidonhangDAL  ttdhangDAL = new tbTrangthaidonhangDAL ();
            ttdhangDAL.Insert (ttdhang );

        }
        public static void update(tbTrangthaidonhang  ttdhang)
        {
            tbTrangthaidonhangDAL  ttdhangDAL = new tbTrangthaidonhangDAL ();
            ttdhangDAL.Update (ttdhang );

        }
      public static void Delete(int iD)
      {
         tbTrangthaidonhangDAL  ttdhangDAL = new tbTrangthaidonhangDAL ();
          ttdhangDAL.Delete(iD);
      }
        public static tbTrangthaidonhangCollection  Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
           tbTrangthaidonhangDAL  ttdhangDAL = new tbTrangthaidonhangDAL ();
            return ttdhangDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }

        public static tbTrangthaidonhangCollection  GetALL()
        {
            int total = 0;
       tbTrangthaidonhangDAL   ttdhDAL = new tbTrangthaidonhangDAL ();
            return ttdhDAL.Get("where 1=1", 0, 0, tbTrangthaidonhangColumn.Matinhtrangdh .ToString(), "ASC", out total);
        }
        public static tbTrangthaidonhang  GetByID(int iD)
        {
            int total = 0;
            tbTrangthaidonhangDAL  ttdhDAL = new tbTrangthaidonhangDAL ();
          tbTrangthaidonhangCollection  ttdhCollection = ttdhDAL.Get("where " +
            tbTrangthaidonhangColumn .Matinhtrangdh .ToString() + "=" + iD.ToString(),
                0, 0, tbTrangthaidonhangColumn .Matinhtrangdh .ToString(), "ASC", out total);
            if (ttdhCollection.Count > 0)
                return ttdhCollection[0];
            return null;
        }
    }
}
